package cn.ncu.wechat.controller;

import cn.ncu.wechat.service.StoreService;
import cn.ncu.wechat.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


@RestController
@RequestMapping("/api/admin/stores")
public class StoreController {
    @Autowired
    private StoreService storeService;

    @GetMapping("")
    public Result<?> getStoreList(@RequestParam(defaultValue = "1") Integer page,
                                  @RequestParam(defaultValue = "10") Integer pageSize,
                                  @RequestParam(defaultValue = "-1") String keyword) {
        return storeService.getStoreList(page, pageSize, keyword);
    }


    @PostMapping("")
    public Result<?> addOrUpdateStore(@RequestBody Map<String, Object> request) {
        return storeService.addOrUpdateStore(request);
    }

}
